Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Replace actions-rs actions in GitHub workflows #678

Merged
merged 7 commits into from
Sep 25, 2024

Conversation

Xanewok
Copy link
Contributor

@Xanewok Xanewok commented Sep 24, 2024

Closes #642

This gets rid of the redundant actions-rs/cargo and moves to the maintained action https://github.com/actions-rust-lang/setup-rust-toolchain instead of actions-rs/toolchain.

Copy link

changeset-bot bot commented Sep 24, 2024

⚠️ No Changeset found

Latest commit: e7796f7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Xanewok Xanewok had a problem deploying to github-action-benchmark September 24, 2024 12:18 — with GitHub Actions Failure
@Xanewok Xanewok added the no changeset needed This PR doesn't require a changeset label Sep 24, 2024
@Xanewok Xanewok force-pushed the ci/migrate-off-actions-rs branch from d559f74 to d322298 Compare September 24, 2024 12:35
@Xanewok Xanewok had a problem deploying to github-action-benchmark September 24, 2024 12:36 — with GitHub Actions Failure
@Xanewok Xanewok had a problem deploying to github-action-benchmark September 24, 2024 12:39 — with GitHub Actions Error
@Xanewok Xanewok had a problem deploying to github-action-benchmark September 24, 2024 13:02 — with GitHub Actions Error
@Xanewok Xanewok temporarily deployed to github-action-benchmark September 24, 2024 13:11 — with GitHub Actions Inactive
override: true

- uses: Swatinem/rust-cache@v2
- uses: ./.github/actions/setup-rust
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main was already merged to feat/multichain, so this should be safe to do, i.e. the action should already be there.

@Xanewok Xanewok requested review from galargh and a team September 24, 2024 13:18
@Xanewok Xanewok marked this pull request as ready for review September 24, 2024 13:18
components: clippy

- uses: Swatinem/rust-cache@v2
run: rustup toolchain install nightly --profile minimal --component rustfmt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@Xanewok Xanewok Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it to be a lot simpler - we just execute setup-rust as our baseline "setup Rust toolchain as expected" and this is the only exception to this. Since it's a one-liner and used only here, I found it simpler to just call this directly and keep the main action lean.

EDIT: To expand a bit on the rationale, I did try that initially, but we'd have to be more explicit, i.e. support and pass override: false for clarity, support and handle components, support it being optional and pass some if missing (I do install always install clippy for simplicity as the cost is near-zero; unfortunately the overhead of cross-platform setup via bash is bigger when using this action vs actions-rs).

The nightly rustfmt is also hopefully only a temporary solution until upstream stabilises the two options that we use, so I did not want to come up with a principled approach to a one-off that's hopefully temporary anyway 🤞

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can have default values for all inputs of an action, which would keep the default action lean too, while allowing configuration.

I'll leave it up to you to decide whether to take that approach or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to find a middle ground in e7796f7, hope that's okay with you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! That's exactly what I had in mind :)

@Xanewok Xanewok temporarily deployed to github-action-benchmark September 25, 2024 10:37 — with GitHub Actions Inactive
@Xanewok Xanewok added this pull request to the merge queue Sep 25, 2024
Merged via the queue into main with commit 2c2c78b Sep 25, 2024
37 checks passed
@Xanewok Xanewok deleted the ci/migrate-off-actions-rs branch September 25, 2024 13:03
Copy link
Member

@galargh galargh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for only getting to it now. I really like how you used cargo directly ❤️ I only have one comment about potentially pinning action versions.

- name: Install Rust (stable)
uses: actions-rs/toolchain@v1
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest pinning the version of this action to a commit ref unless it comes from an organization we own or trust. Otherwise, we could open up an attack vector.

      uses: actions-rust-lang/setup-rust-toolchain@4d1965c9142484e48d40c19de54b5cba84953a06 # v1.1.0

Ref: https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changeset needed This PR doesn't require a changeset
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace actions-rs actions in GitHub workflows
3 participants